package cn.iocoder.yudao.module.picturebook.dal.mysql.workmember;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.workmember.WorkMemberDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.workmember.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 作业与成员关系表	 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WorkMemberMapper extends BaseMapperX<WorkMemberDO> {

    default PageResult<WorkMemberDO> selectPage(WorkMemberPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WorkMemberDO>()
                .eqIfPresent(WorkMemberDO::getWorkId, reqVO.getWorkId())
                .eqIfPresent(WorkMemberDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(WorkMemberDO::getStuat, reqVO.getStuat())
                .betweenIfPresent(WorkMemberDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WorkMemberDO::getMemberWorkId));
    }

    List<WorkMemberDO> getWorkMemberByClassIdAndUserId(@Param("classId") Long classId, @Param("userId") Long userId);

    WorkMemberDO queryWorkMemberByWorkIdAndClassIdAndUserId(@Param("id") Long id, @Param("classId") Long classId, @Param("userId") Long userId);

    int getWorkMemberCompleteCount(@Param("id") Long id, @Param("classId")Long classId);

    List<WorkMemberDO> getWorkMemberFinish(@Param("classId") Long classId, @Param("workId") Long workId);

    List<WorkMemberDO> getWorkMemberUnFinish(@Param("classId") Long classId, @Param("workId") Long workId);

    void updateWorkMemberStuat(Long memberWorkId);
}